package view_api

import (
	"fmt"
	"gin-vue-admin/global"
	"gin-vue-admin/model"
	"gin-vue-admin/model/request"
	"gin-vue-admin/model/response"
	"gin-vue-admin/service"
	"github.com/gin-gonic/gin"
)

type SystemConfigMap struct {
	model.Config
	CNoteType []string  `json:"c_note_type"`
	ClientType []string `json:"client_type"`
	Ctype []string `json:"ctype"`
}
func SystemConfig(c *gin.Context){
	responseData := map[string]interface{}{}
	info := request.ConfigSearch{}
	info.Value = `abcde`
	_,data,_ := service.GetConfigInfoList(info)
	mapData := data.([]model.Config)
	for _,item := range mapData{
		responseData[item.Key]  = item.Value
	}
	otherInfo := request.CTypesSearch{}
	_, list, _ := service.GetCTypesInfoList(otherInfo)
	fmt.Println(list)
	responseData[`c_types`] = list
	responseData[`c_note_type`] = global.CNoteType
	responseData[`client_type`] = map[string]interface{}{}
	responseData[`client_type`] = global.ClientType
	responseData[`c_type`] = map[string]interface{}{}
	responseData[`c_type`] = global.Ctype
	response.OkWithData(responseData,c)
}